package box.tuson.com.tusonbox;
import android.support.v7.app.*;
import android.os.*;
import android.widget.*;
import cn.bmob.v3.*;
import box.tuson.com.tusonbox.bmob.jyfk;
import android.view.View.*;
import android.view.*;
import cn.bmob.v3.exception.*;
import cn.bmob.v3.listener.*;
public class jyyfk extends AppCompatActivity
{
	private EditText nr;
	private Button tj;
	@Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.jyyfk);
		Bmob.initialize(this, "9a567bc11b8632383f69cd4c165c5a2a");
		nr = (EditText) findViewById(R.id.jyyfkEditText1);
		tj = (Button) findViewById(R.id.jyyfkButton1);
		tj.setOnClickListener(new OnClickListener(){

				@Override
				public void onClick(View p1)
				{
					// TODO: Implement this method
					String fk = nr.getText().toString();
					if (fk.equals(""))
					{
						Toast.makeText(jyyfk.this, "您还没有建议或反馈呢!别忘了哦 ❛‿˂̵✧", 0).show();
					}
					else
					{	
						inti();
					}
					
					}
			});
		}
		private void inti(){
			final jyfk p2 = new jyfk();
			String fk = nr.getText().toString();
			p2.setcontent(fk);
			p2.save(this, new SaveListener() {
					@Override
					public void onSuccess() {
						// TODO Auto-generated method stub
						//toast("添加数据成功，返回objectId为："+p2.getObjectId());
						Toast.makeText(getApplicationContext(), "提交成功啦!感谢您的提交(´• ᵕ •`)* "+p2.getObjectId(), Toast.LENGTH_SHORT).show();
					}

					@Override
					public void onFailure(int code, String msg) {
						// TODO Auto-generated method stub
						//toast("创建数据失败：" + msg);
						Toast.makeText(getApplicationContext(), "提交失败咯Σ( °吓°|||)︴请联系开发者QQ153464447 "+ msg, Toast.LENGTH_SHORT).show(); 
					}
				});
		}
		
}
